package WaiBao;

import java.util.Arrays;

public class JiaRuiYing {
    public static void main(String[] args) {
        String[] name = {"张文宏(班长)", "丁邵燕(团支书)", "小李(学习委员)", "王湾评(体育委员)", "王忠庆", "黄静雯", "刘新玲", "堂行医", "唐心怡", "徐亚茹", "王亚茹", "杜世豪",
                "林秀气", "凌志平", "张建峰", "李家德", "吴冲男", "肖忠义", "徐亚为", "周丽梅", "李村寻", "黄雅莉", "刘方毅", "张家荣", "徐主任", "陈配模", "蔡整型", "黄文建",
                "安琪拉", "贾瑞英(学生)"};//考生本人: 贾瑞英(学生)
        int[] Age = {20, 19, 18, 21, 20, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁

        double[] yew1 = {98, 82, 94, 80, 78, 69, 78, 89, 80, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] yew2 = {88, 85, 79, 76, 88, 77, 88, 79, 90, 90, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 94};
        double[] yew3 = {78, 96, 90, 85, 71, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};


        double wattle;//代表每个学生的总分
        double ebony;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            wattle = yew1[i] + yew2[i] +yew3[i];
//            ebony= (  wattle * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +  wattle);
//            System.out.println(name[i] + "的平均分为:" +ebony);
//        }


        double rowan = 0, lindn = 0;
        double[] elm = new double[30];
//        for (int i = 0; i < 30; i++) {
//            rowan  = yew1[i] + yew2[i] + yew3[i];
//            lindn = (rowan  * 1.0) / 3;
//            elm[i] = lindn;
//        }
//
//        for (int i = 0; i < elm.length - 1; i++) {
//            for (int j = 0; j < elm.length - i - 1; j++) {
//                if (elm[j] < elm[j + 1]) {
//                    double tep = elm[j];
//                    elm[j] =elm[j + 1];
//                    elm[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(elm[i]);
//        }


        double fish1 = 0,fish2 = 0, fish3 = 0;//计算每门课的平均分
        double dog1 = 0,dog2 = 0, dog3 = 0;//计算每门课标准差
        double cat1 = 0, cat2 = 0, cat3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < yew1.length; i++) {
            sum2+=yew1[i];
        }
        fish1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+fish1);
        double Sum = 0;
        for (int i = 0; i < yew2.length; i++) {
            Sum+=yew2[i];
        }
        fish2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+fish2);
        double sum = 0;
        for (int i = 0; i <yew3.length; i++) {
            sum+=yew3[i];
        }
        fish3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+fish3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <yew1.length; i++) {
            c1+= (yew1[i] -fish1)*(yew1[i] - fish1);
        }
        dog1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+dog1);

        for (int i = 0; i < yew2.length; i++) {
            c2+= (yew2[i] - fish2)*(yew2[i] - fish2);
        }
        dog2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+dog2);

        for (int i = 0; i < yew3.length; i++) {
            c3+= (yew3[i] -fish3)*(yew3[i] - fish3);
        }
        dog3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+dog3);
////
////
//        Arrays.sort(yew1);
//        Arrays.sort(yew2);
//        Arrays.sort(yew3);
//        cat1 =( yew1[14]+yew1[15])*1.0/2;
//        cat2 =( yew2[14]+yew2[15])*1.0/2;
//        cat3 =( yew3[14]+yew3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+cat1);
//        System.out.println("微生物学的中位数为:"+cat2);
//        System.out.println("人体组织解剖学的中位数为:"+cat3);

    }
}
